<template>
  <fieldset>
    <legend>购物车</legend>
    <button @click="gain">点击获取购物车</button>
    <ul>
      <li v-for="ie in record" :key="ie.id">{{ ie.title }}</li>
    </ul>
  </fieldset>
</template>
<script>
import axios from "axios";
export default {
  data() {
    return {
      record: [],
    };
  },
  methods: {
    gain() {
      axios
        .get("/api/data/index.json", {
          params: { name: "购物车" },
          headers: {
            be: "xani23",
          },
        })
        .then((res) => {
          console.log(res);
          this.record = res.data.data;
        })
        .catch((err) => {
          console.log(err);
        });
    },
  },
};
</script>
